package com.designPatterns.proxy;

/**
 * 强制代理, 当访问真实角色,因故不能处理,强制转为由代理执行
 * Created by houjinxin on 16/3/29.
 */
public class StaticProxy3 implements ITarget3, IProxy {

    private ITarget3 target;

    public StaticProxy3(ITarget3 target) {
        this.target = target;
    }

    @Override
    public void say(String word) {
        this.before();
        this.target.say(word);
        this.after();
    }

    @Override
    public ITarget3 getProxy() {
        return this;
    }

    public void before() {
        System.out.println("前置增强！");
    }

    public void after() {
        System.out.println("后置增强！");
    }
}
